You can attach behaviors to the entire document, or to links, images, form elements, layers, or almost any HTML element.
You can specify more than one event to trigger a behavior, and more than one action for each event. Actions occur in the order listed in the Action pane of the Behavior inspector. See Changing a behavior for information on changing the order of actions.
Note: Many useful events such as onMouseDown
, onMouseOver
, and onMouseOut
are only available for links (items with an <A>
tag). Dreamweaver can automatically add the <A>
tag when you choose one of these events for an image. For example, if you selected an image and attach a behavior triggered by onMouseOver
, the resulting code would look something like this:
<a href="#" onmouseover="MM_playSound('MM_playSound1')"><img src="/Picture.gif"></a>.
To attach a behavior:
1 | Select an object. To attach a behavior to the entire page, click the <BODY> tag in the tag selector at the bottom left of the Document window. |
2 | Choose Window > Behaviors to open the Behavior inspector, or click the Behavior button on the Launcher. |
The tag of the selected object appears in the status bar at the top of the inspector. | |
3 | Choose the browsers in which you want the behavior to work from the pop-up menu to the right of Events. |
Different browsers recognize different events. Dreamweaver eliminates events that aren't recognized by the browsers you choose from this menu. | |
4 | Click the Events pop-up menu and choose an event to trigger the Behavior. |
Different events appear depending on the selected object. If the expected events don't appear, make sure that the correct object is selected. | |
If you're attaching a behavior to an image, several events such as onMouseOver and onMouseDown appear in parentheses. These events are only available for links. When you choose one of them, Dreamweaver adds an <A> tag to the image to define a link. Do not delete the pound sign (#) that subsequently appears in the Link box in the Property inspector, or you will remove the behavior. You can replace the pound sign with a new link value. |
|
5 | Choose an action from the Actions pop-up menu. |
Actions that don't work in the current document are not available on the menu. For example, the Play Timeline action is not available if the document has no timeline. | |
Depending on the chosen action, a dialog box appears to display parameters and instructions for the action. | |
6 | Enter parameters for the action and click OK. |
All included actions work in 4.0 or later browsers. Some actions do not work on older browsers. See Browser compatibility for actions. | |
![]() |